<template>
	<view class="container">
		<!-- 导航栏 -->
		<uni-nav-bar right-icon="bars"></uni-nav-bar>
		
		<!-- 卡片 -->
		<uni-card title="用户姓名" extra="个人主页" :thumbnail="avatar" @click="onClick">
			<!-- 宫格 -->
			<uni-grid :column="3" :show-border="false" :square="false" :highlight="false">
				<uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
					<navigator :url="item.url">
						<view class="grid-item-container">
							<view class="icon-container"><uni-icons :type="item.icon" size="36" ></uni-icons></view>
							<text class="text">{{ item.text }}</text>
						</view>
					</navigator>
				</uni-grid-item>
			</uni-grid>
		</uni-card>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				avatar: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png',
				list: [{
						icon: 'cart',
						text: '我的订单',
						url: '/pages/orders/orders',
					},
					{
						icon: 'wallet',
						text: '我的账户',
						url: '/pages/order/order',
					},
					{
						icon: 'person',
						text: '个人信息',
						url: '',
					}
				]
			}
		},
		methods: {
			onClick(e){
				console.log(e)
			},
		}
	}
</script>

<style>
	.container {
		padding: 20px;
		font-size: 14px;
		line-height: 24px;
	}
	.grid-item-container{
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		text-align: center;
		padding: 10px;
		margin-top: 10px;
	}
	.icon-container{
		margin-bottom: 5px;
	}
	.text{
		font-size: 16px;
	}
</style>
